package com.ozo.cloud.gen.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 数据库表新建对象
 * </p>
 *
 * @author qiangesoft
 * @date 2024-03-13
 */
@Schema(description = "数据库表新建对象")
@Data
public class GenTableCreateDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Pattern(regexp = "^[a-z0-9_]+$", message = "表名只能为小写英文字母、数字和_")
    @NotBlank(message = "表名不能为空")
    @Schema(description = "表名")
    private String tableName;

    @NotBlank(message = "表注释不能为空")
    @Schema(description = "表注释")
    private String tableComment;

    @NotNull(message = "是否继承基类不能为空")
    @Schema(description = "是否继承基类")
    private Boolean extendBaseEntity;

    @Valid
    @NotEmpty(message = "表字段不能为空")
    @Schema(description = "表字段")
    private List<GenTableColumnCreateDTO> columnList;

}
